package domain;
// Generated 11-jul-2009 12:00:40 by Hibernate Tools 3.2.1.GA


import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Consumption generated by hbm2java
 */
@Entity
@Table(name="consumption"
    ,catalog="domeco"
)
public class Consumption  implements java.io.Serializable {


     private Integer idCons;
     private Contract contract;
     private double amount;
     private Set<Waterconsumption> waterconsumptions = new HashSet<Waterconsumption>(0);
     private Set<Insuranceconsumption> insuranceconsumptions = new HashSet<Insuranceconsumption>(0);
     private Set<Mobileconsumption> mobileconsumptions = new HashSet<Mobileconsumption>(0);
     private Set<Mortgageconsumption> mortgageconsumptions = new HashSet<Mortgageconsumption>(0);
     private Set<Electricityconsumption> electricityconsumptions = new HashSet<Electricityconsumption>(0);

    public Consumption() {
    }

	
    public Consumption(Contract contract, double amount) {
        this.contract = contract;
        this.amount = amount;
    }
    public Consumption(Contract contract, double amount, Set<Waterconsumption> waterconsumptions, Set<Insuranceconsumption> insuranceconsumptions, Set<Mobileconsumption> mobileconsumptions, Set<Mortgageconsumption> mortgageconsumptions, Set<Electricityconsumption> electricityconsumptions) {
       this.contract = contract;
       this.amount = amount;
       this.waterconsumptions = waterconsumptions;
       this.insuranceconsumptions = insuranceconsumptions;
       this.mobileconsumptions = mobileconsumptions;
       this.mortgageconsumptions = mortgageconsumptions;
       this.electricityconsumptions = electricityconsumptions;
    }
   
     @Id @GeneratedValue(strategy=IDENTITY)
    
    @Column(name="idCons", unique=true, nullable=false)
    public Integer getIdCons() {
        return this.idCons;
    }
    
    public void setIdCons(Integer idCons) {
        this.idCons = idCons;
    }
@ManyToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="consFK", nullable=false)
    public Contract getContract() {
        return this.contract;
    }
    
    public void setContract(Contract contract) {
        this.contract = contract;
    }
    
    @Column(name="amount", nullable=false, precision=22, scale=0)
    public double getAmount() {
        return this.amount;
    }
    
    public void setAmount(double amount) {
        this.amount = amount;
    }
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="consumption")
    public Set<Waterconsumption> getWaterconsumptions() {
        return this.waterconsumptions;
    }
    
    public void setWaterconsumptions(Set<Waterconsumption> waterconsumptions) {
        this.waterconsumptions = waterconsumptions;
    }
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="consumption")
    public Set<Insuranceconsumption> getInsuranceconsumptions() {
        return this.insuranceconsumptions;
    }
    
    public void setInsuranceconsumptions(Set<Insuranceconsumption> insuranceconsumptions) {
        this.insuranceconsumptions = insuranceconsumptions;
    }
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="consumption")
    public Set<Mobileconsumption> getMobileconsumptions() {
        return this.mobileconsumptions;
    }
    
    public void setMobileconsumptions(Set<Mobileconsumption> mobileconsumptions) {
        this.mobileconsumptions = mobileconsumptions;
    }
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="consumption")
    public Set<Mortgageconsumption> getMortgageconsumptions() {
        return this.mortgageconsumptions;
    }
    
    public void setMortgageconsumptions(Set<Mortgageconsumption> mortgageconsumptions) {
        this.mortgageconsumptions = mortgageconsumptions;
    }
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="consumption")
    public Set<Electricityconsumption> getElectricityconsumptions() {
        return this.electricityconsumptions;
    }
    
    public void setElectricityconsumptions(Set<Electricityconsumption> electricityconsumptions) {
        this.electricityconsumptions = electricityconsumptions;
    }




}


